package org.coderjonny.service.impl;

import org.coderjonny.bean.Product;
import org.coderjonny.dto.product.ProductId;
import org.coderjonny.dto.product.UpdateStock;
import org.coderjonny.mapper.ProductMapper;
import org.coderjonny.service.ProductService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class ProductServiceImpl implements ProductService {
    @Resource
    ProductMapper productMapper;
    @Override
    public Product getProductById(ProductId productId) {
        return productMapper.selectById(productId.getProductId());
    }

    @Override
    public int updateStockById(UpdateStock updateStock) {
        return productMapper.updateProductStockById(updateStock.getProductId(),updateStock.getCount());
    }
}
